package com.ddxz.demo.quartz.task;

import com.ddxz.demo.quartz.service.TaskService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * class description
 *
 * @author 朱宗刚
 * @version 1.0.0
 * @date 2020/11/24
 */

public class DdxzQuartzJob implements Job, ConstData {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("[{}-{}], starting...", jobExecutionContext.getJobDetail().getJobDataMap().get(GROUP_KEY),
                jobExecutionContext.getJobDetail().getJobDataMap().get(JOB_KEY));

        TaskService service = (TaskService) jobExecutionContext.getJobDetail().getJobDataMap().get(THREAD_KEY);
        for(int i = 0; i < 5; ++i) {
            service.startUpload(i);
        }
    }

    private static final Logger logger = LoggerFactory.getLogger(DdxzQuartzJob.class);
}
